package com.bw.demo.dbiao;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;
/*
* 把结果封装成一个实体类
*/
public class DbiaoBean implements Writable{
	private String id;//订单id
	private String date;//订单时间
	private String spid;//商品id
	private int amount;//订单数量
	private String name;//商品名称
	private String cateid;//商品型号
	private float price;//商品价格
	private String table;//表名,用来记录数据来自哪个文本
	
	public DbiaoBean() {
		super();
	}
	
	public DbiaoBean(String id, String date, String spid, int amount, String name, String cateid, float price,
			String table) {
		super();
		this.id = id;
		this.date = date;
		this.spid = spid;
		this.amount = amount;
		this.name = name;
		this.cateid = cateid;
		this.price = price;
		this.table = table;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getSpid() {
		return spid;
	}

	public void setSpid(String spid) {
		this.spid = spid;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCateid() {
		return cateid;
	}

	public void setCateid(String cateid) {
		this.cateid = cateid;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public String getTable() {
		return table;
	}

	public void setTable(String table) {
		this.table = table;
	}
	
	@Override
	public void readFields(DataInput input) throws IOException {
		this.id = input.readUTF();
		this.date = input.readUTF();
		this.spid = input.readUTF();
		this.amount = input.readInt();
		this.name = input.readUTF();
		this.cateid = input.readUTF();
		this.price = input.readFloat();
		this.table = input.readUTF();
	}
	@Override
	public void write(DataOutput output) throws IOException {
		output.writeUTF(id);
		output.writeUTF(date);
		output.writeUTF(spid);
		output.writeInt(amount);
		output.writeUTF(name);
		output.writeUTF(cateid);
		output.writeFloat(price);
		output.writeUTF(table);
	}

	@Override
	public String toString() {
		return id + "----" + date + "----" + spid + "----" + amount + "----" + name
				+ "----" + cateid + "----" + price ;
	}
	
	
	
	
}
